<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <script src="../js/vue.js"></script>
    <style>
        #app{
            background-color:#ccc;
            padding:10px;
        }
        .childOne{
            background-color:skyblue;
            padding:10px;
        }
        .childTwo{
            background-color:pink;
            padding:10px;
        }
    </style>
</head>
<body>
    <div id="app">
        <p>compA</p>
        <hr>
        <comp-b></comp-b>
        <hr>
        <comp-c></comp-c>
    </div>
    <template id="compB">
        <div class="childOne">
            <p>compB</p>
            <hr>
            <comp-d></comp-d>
            <hr>
            <comp-e></comp-e>
        </div>
    </template>
    <template id="compC">
        <div class="childOne">
            <p>compC</p>
        </div>
    </template>
    <template id="compD">
        <div class="childTwo">
            <p>compD</p>
        </div>
    </template>
    <template id="compE">
        <div class="childTwo">
            <p>compE</p>
        </div>
    </template>
</body>
<script>
    new Vue({
        el:"#app",
        components:{
            compB:{
                template:"#compB",
                components:{
                    compD:{
                        template:"#compD",
                        beforeMount(){
                            console.log("beforeMount-compD");
                        },
                        mounted(){
                            console.log("mounted-compD")
                        }
                    },
                    compE:{
                        template:"#compE",
                        beforeMount(){
                            console.log("beforeMount-compE");
                        },
                        mounted(){
                            console.log("mounted-compE")
                        }
                    }
                },
                beforeMount(){
                    console.log("beforeMount-compB");
                },
                mounted(){
                    console.log("mounted-compB")
                }
            },
            compC:{
                template:"#compC",
                beforeMount(){
                    console.log("beforeMount-compC");
                },
                mounted(){
                    console.log("mounted-compC")
                }
            }
        },
        beforeMount(){
            console.log("beforeMount-compA");
        },
        mounted(){
            console.log("mounted-compA")
        }
    })
</script>
</html>